package com.example.mysql_mybatis_demo.springsource.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
// @Component
public class Zfinal1 {
    @Bean
    public Zfinal3 zfinal3(){
        return new Zfinal3();
    }
    @Bean
    public Zfinal2 zfinal2(){
        Zfinal3 zfinal3 = zfinal3();
        return new Zfinal2(zfinal3);
    }
}

class Zfinal3 {
    public Zfinal3() {
        System.out.println("create 3:" + this);
    }
}

class Zfinal2 {
    public Zfinal2(Zfinal3 zfinal3) {
        System.out.println("create 2 by 3:" + zfinal3);
    }
}
